package TestApp;


import Questions.Question;
import Questions.QuestionsFactory;
import Sources.SourceTests;

import java.util.ArrayList;

/**
 * @author Myhaylo Kotsyuruba
 * @version v.1.4   14.03.13
 */

public class TestCreator {

    private QuestionsFactory myQuestionsFactory;

    public TestCreator() {
        myQuestionsFactory = new QuestionsFactory();
    }
    
    public Test createTest(String[] data) {
        ArrayList<Question> questions = new ArrayList<Question>();
        for (int index = 1; index < data.length; index++) {
            Question question = myQuestionsFactory.createQuestion(data[index]);
            questions.add(question);
        }
        return new Test(data[0], questions);
    }

    public Test createTest() {
        return SourceTests.getTest();
    }
}
